package org.example.customstarter.controller;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.example.customstarter.demos.web.Book;
import org.example.customstarter.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BookController {


    @Autowired
    private BookService bookService;

    @GetMapping("/book")
    public String getBook(Model model) {
        List<Book> list = bookService.list();
        model.addAttribute("list", list);
        return "book";
    }

}
